package es.udima.geo.geoserver.entities;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class UserSession {

    private String userId;
    private String sessionToken;
    private Calendar lastTimeUsed;

    public UserSession() {
    }

    public String getUserId() {
	return userId;
    }

    public void setUserId(String userId) {
	this.userId = userId;
    }

    public String getSessionToken() {
	return sessionToken;
    }

    public void setSessionToken(String sessionToken) {
	this.sessionToken = sessionToken;
    }

    public Calendar getLastTimeUsed() {
	return lastTimeUsed;
    }

    public void setLastTimeUsed(Calendar lastTimeUsed) {
	this.lastTimeUsed = lastTimeUsed;
    }

    @Override
    public String toString() {
	SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy HH:mm:ss,SSS");
	String ltu = null;
	if(lastTimeUsed!=null) {
	    ltu = sdf.format(lastTimeUsed.getTime());
	}
	return "UserSession [userId=" + userId + ", sessionToken=" + sessionToken + ", lastTimeUsed=" + ltu + "]";
    }

}
